<template>
  <div class="audio-wrap">
    <div :class="['audio-pic', { play: playing }]"></div>
    <audio
      :src="resourceUrl"
      @pause="playing = false"
      @play="playing = true"
      @ended="playing = false"
      controls
      autoplay
    ></audio>
  </div>
</template>
<script>
export default {
  data() {
    return {
      resourceUrl: '',
      playing: false,
    }
  },
  props: ['row', 'resource'],
  mounted() {
    let { httpUrl } = this.resource
    this.resourceUrl = httpUrl
  },
  methods: {},
}
</script>
<style scoped lang="scss">
.audio-wrap {
  position: relative;
  height: 100%;
  padding-top: 100px;
  box-sizing: border-box;
  background: #f5f5f5;
  // background: url('../../../netDisk/preview/musicbg.jpeg') no-repeat center;
  background-size: cover;
  audio {
    position: absolute;
    left: 2%;
    bottom: 10px;
    width: 96%;
  }
  .audio-pic {
    width: 100%;
    height: 260px;
    margin-bottom: 20px;
    // background: url('../../../netDisk/preview/audio.png') no-repeat center;
    background-size: contain;
    &.play {
      animation: fadenum 10s linear infinite;
    }
  }
  @keyframes fadenum {
    0% {
      transform: rotate(0deg);
    }
    100% {
      transform: rotate(360deg);
    }
  }
}
</style>